﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using KPIS.GERP.GHRMS.DAL;
using KPIS.GERP.GHRMS.MODEL;

namespace KPIS.GERP.GHRMS.BLL
{
    public class TrainingCoursesDesDtlsBLL
    {
        private static readonly TrainingCoursesDesDtlsDAL dal = new TrainingCoursesDesDtlsDAL();
        ConvertNullable cn = new ConvertNullable();

        public void InsertByTrainee(string TrainSeq, string EmpSeq, string Name, string JobSite, string WorkText, string Position, string Class, string Crateby)
        {
            int iTrainSeq = Convert.ToInt32(TrainSeq);
            Nullable<int> iEmpSeq = cn.ConvertNullInt(EmpSeq);
            Nullable<int> iJobSite = cn.ConvertNullInt(JobSite);
            Nullable<int> iCrateby = cn.ConvertNullInt(Crateby);
            dal.InsertByTrainee(iTrainSeq, iEmpSeq, Name, iJobSite,WorkText, Position, Class, iCrateby);
        }

        public DataSet GetData(string EmpSeq, string TrainSeq, string Granted)
        {
            Nullable<int> iEmpSeq = cn.ConvertNullInt(EmpSeq);
            Nullable<int> iTrainSeq = cn.ConvertNullInt(TrainSeq);
            Nullable<int> iGranted = cn.ConvertNullInt(Granted);
            return dal.GetData(iEmpSeq, iTrainSeq, iGranted);
        }
        public DataSet GetDataTreeView()
        {
            return dal.GetDataTreeView();
        }
        public void DeleteTrainee(int TraineeSeq, string UpdatedBy)
        {
            Nullable<int> iUpdateBy = cn.ConvertNullInt(UpdatedBy);
            dal.DeleteTrainee(TraineeSeq, iUpdateBy);
        }
        public void DeleteQuta(int TraineeSeq, string UpdatedBy)
        {
            Nullable<int> iUpdateBy = cn.ConvertNullInt(UpdatedBy);
            dal.DeleteQuta(TraineeSeq, iUpdateBy);
        }

        public void InsertQuta(string TraineeSeq, string TrainSeq, string EmpSeq, string Comment, string TrainResult, string TrainHour, string scored_by, string Granted)
        {
            int iTrainSeq = Convert.ToInt32(TrainSeq);
            Nullable<int> iEmpSeq = cn.ConvertNullInt(EmpSeq);
            Nullable<int> iTraineeSeq = cn.ConvertNullInt(TraineeSeq);
            Nullable<int> iTrainHour = cn.ConvertNullInt(TrainHour);
            Nullable<int> iscored_by = cn.ConvertNullInt(scored_by);
            Nullable<int> iGranted = cn.ConvertNullInt(Granted);
            Nullable<int> iTrainResult = cn.ConvertNullInt(TrainResult);
            dal.InsertQuta(iTraineeSeq, iTrainSeq, iEmpSeq, Comment, iTrainResult, iTrainHour, iscored_by, iGranted);
        }
        public void UpdateTrainee( int TraineeSeq, string TrainSeq, string EmpSeq, string Name, string JobSite, string WorkText, string Position, string Class, string UpdatedBy)
        {
            int iTrainSeq = Convert.ToInt32(TrainSeq);
            int iTraineeSeq = Convert.ToInt32(TraineeSeq);
            Nullable<int> iEmpSeq = cn.ConvertNullInt(EmpSeq);
            Nullable<int> iJobSite = cn.ConvertNullInt(JobSite);
            Nullable<int> iUpdateBy = cn.ConvertNullInt(UpdatedBy);
            dal.UpdateTrainee(TraineeSeq, iTrainSeq, iEmpSeq, Name, iJobSite,WorkText, Position, Class, iUpdateBy);
        }
    }
}
